var express = require('express');

var router = express.Router();      /*可使用express.Router类创建模块化、可挂载的路由句柄*/

//后台的路由，所有的后台处理
var login = require("./backstage/login.js");    //二级路由

var launchExam = require("./backstage/launchExam.js");

var createExam = require("./backstage/createExam.js");

var addStudent = require("./backstage/addStudent.js");

var addTeacher = require("./backstage/addTeacher.js");

var endExam = require("./backstage/endExam.js");

var addpage = require("./backstage/addpage.js");

var showpage = require("./backstage/showpage.js");

var showstudents = require("./backstage/showstudents.js");

var addpagelist = require("./backstage/addpageList.js");

var endpagelist = require("./backstage/endpageList.js");

var endpage = require("./backstage/endpage.js");

var pages = require("./backstage/pages.js");

var goExam = require("./backstage/goExam.js");

var goingExam = require("./backstage/goingExam.js");

var publicHeader = require("./admin/publicjs/public.js");    //二级路由

var exam = require("./admin/exam.js");    //二级路由

var index = require("./admin/index.js");    //二级路由

var analysis = require("./admin/analysis.js");    //二级路由

var personal = require("./admin/personal.js");    //二级路由

var myClass = require("./admin/myClass.js");    //二级路由

var myExam = require("./admin/myExam.js");    //二级路由

var myExam1 = require("./admin/myExam1.js");    //二级路由

var myExam2 = require("./admin/myExam2.js");    //二级路由

var notFound = require("./admin/notFound.js");    //二级路由

//配置路由，app.use内部实际调用了router.use

router.use('/login',login);     //映射到login的路由

router.use('/launchExam',launchExam);     //映射到launchExam的路由

router.use('/createExam',createExam);

router.use('/addStudent',addStudent);

router.use('/addTeacher',addTeacher);

router.use('/endExam',endExam);

router.use('/addpage',addpage);

router.use('/showpage',showpage);

router.use('/pages',pages);

router.use('/goExam',goExam);

router.use('/showstudents',showstudents);

router.use('/addpagelist',addpagelist);

router.use('/endpagelist',endpagelist);

router.use('/endpage',endpage);

router.use('/goingExam',goingExam);

router.use('/public',publicHeader);     //映射到public的路由

router.use('/exam',exam);     //映射到exam的路由

router.use('/index',index);     //映射到index的路由

router.use('/analysis',analysis);     //映射到analysis的路由

router.use('/personal',personal);     //映射到personal的路由

router.use('/myClass',myClass);     //映射到myClass的路由

router.use('/myExam',myExam);     //映射到myExam的路由

router.use('/myExam1',myExam1);     //映射到myExam的路由

router.use('/myExam2',myExam2);     //映射到myExam的路由

router.use('/404',notFound);     //映射到myExam的路由
//如果以上不存在，则会走下面这个
router.use("/",function(req,res){
    res.render('webPage/notFound');
})

module.exports = router;    /*暴露router模块*/


